package com.jt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jt.pojo.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 刘昱江
 * 时间 2021/3/3
 */
public interface RoleMapper extends BaseMapper<Role> {
    @Select("select rights_id from role_rights where role_id = #{roleId}")
    List<Integer> findRightsIdList(int roleId);
    @Delete("delete from role_rights where role_id = #{roleId} and rights_id = #{id}")
    void deleteRoleRightsById(Integer roleId, Integer id);
    void deleteRoleRights(Integer roleId, List<Integer> rightsIdList);
    @Delete("delete from role_rights where role_id = #{roleId}")
    void deleteRightsAllByRoleId(Integer roleId);

    void insertRightsByRoleId(Integer roleId, Integer[] rightsIds);
}
